#include"com.hpp"

int main()
{
    //创建管道
    create_namepipe(namepipe_path);
    //只读方式打开文件
    int fd = open(namepipe_path, O_RDONLY);
    assert(fd != -1);

    char buff[read_max];

    while(true)
    {
        ssize_t s = read(fd, buff, read_max - 1);
        assert(s >= 0);
        if (s > 0)
        {
            std::cout << buff << std::endl;
        }
        if (s == 0)
        {
            std::cout << "com end! " << std::endl;
            break;
        }
    }
    
    return 0;
}